<?php

namespace App\Admin\Controllers;

use Encore\Admin\Form;
use Encore\Admin\Grid;
use App\Models\ProductLink;
use Encore\Admin\Controllers\AdminController;

class PorductLinksController extends AdminController
{
    protected $title = '用户推荐上架链接';

    protected function grid()
    {
        $grid = new Grid(new ProductLink());
        $grid->model()->orderBy('id');

        $grid->column('id', 'ID');
        $grid->column('user_id', '会员')->display(function () {
		    return $this->user ? $this->user->nameText(true) : '';
	    });
        $grid->column('link', '链接');
        

        $grid->disableRowSelector();
        $grid->disableColumnSelector();
        $grid->disableExport();
        $grid->disableCreateButton();
        $this->gridActions($grid);

        return $grid;
    }

	protected function gridActions(Grid $grid)
	{
		$grid->actions(function (Grid\Displayers\Actions $actions) {
			$actions->disableView();
			$actions->disableDelete();
            $actions->disableAll();
		});
	}

   
}
